package com.fht.util;

import com.fht.constant.ManagermentSystemConstant;

public class UnitConversionUtil {


    public static String conversion(Integer num){
        if (null == num || num == 0 )
            return "";
        return String.valueOf(num/ ManagermentSystemConstant.PRICE_TRANSITION);
    }

    public static Integer conversion(String num){
        if ("".equals(num) || num == null)
            return 0;
        return (int)(Double.valueOf(num)*ManagermentSystemConstant.PRICE_TRANSITION);
    }

    public static String conversionDate(String date){
        if (!"".equals(date) && null != date) {
            date = date.substring(0, date.lastIndexOf("."));

        }
        return date;
    }

    public static String conversionDateContrary(String date){
        if ("".equals(date) ) {
            return null;
        }
        return date;
    }

    public static  String conversionTrue(String trueFalse){
        if ("0".equals(trueFalse)){
            return "false";
        }
        return "true";
    }
    public static  String conversionTrueContrary(String trueFalse){
        if ("on".equals(trueFalse)){
            return "1";
        }
        return "0";
    }


}
